class A_QUEUE{T} < $QUEUE{T}
****
An array-based queue that expands using amortized doubling.


Flattened version is here

Ancestors
$QUEUE{_} $DISPENSER{_} $STR $CONTAINER{_}
$ELT{_} $ELT COMPARE{_}

Descendants
QUEUE{_}



Public


Features
copy: SAME
create(a: $ELT{T}): SAME
**** Create from an ordered container of elements "a" Insert all the elements in "a" into the queue such that the last element of "a" will also be the last element of the queue
create: SAME
create_capacity(allocate: INT): SAME
**** Create, allocating for "allocate" elements. Can grow later
create_from(a: ARRAY{T}): SAME
**** Create from elements of the array "a". Convenient to specify the queue using an array literal as argument
current: T
enq(e: T)
**** Enqueue the element "e" into the tail of the queue
has(el: T): BOOL
is_empty: BOOL
remove: T
**** Error if the queue is empty
size: INT
**** Return the number of elements in the queue
str: STR
top: T
**** Return the top most elemetn of the queue

Iters
elt!: T
**** Return the elements in the queue in their normal order without changing the queue. Starts with the head of the queue and works downward


Private

attr buf: ARRAY{T};
****
attr buf: ARRAY{T};
****
build(sz: INT): SAME
attr head: INT;
**** Index of head
attr head: INT;
**** Index of head
attr tail: INT;
**** Index of next insert
attr tail: INT;
**** Index of next insert

The Sather Home Page